package br.com.lh.urabuilder.view.arrow.drawer
{
	import br.com.lh.urabuilder.util.CoordinatesUtils;
	
	import flash.geom.Point;
	
	import mx.controls.Image;
	
	public class ArrowContainerSelfDrawer implements IArrowContainerDrawer
	{
		private var startImage:Image;
		
		
		public static const OFFSET_SELF_ARROW_HEIGHT:int = 10;
		public static const HALF_CONTAINER_HEIGHT:Number=10;
		
		public function ArrowContainerSelfDrawer(startImage:Image){
			this.startImage = startImage;
		}
		
//		public function drawContainer():void{
//			var relativeStartPoint:Point = new Point(this.width - 
//			(CoordinatesUtils.SELF_ARROW_WIDTH) - (startComponent.image.width >> 2),0);
//			var relativeEndPoint:Point = relativeStartPoint;
//			arrowWrapper = new ArrowWrapper(relativeStartPoint,relativeEndPoint,selfArrow);
//			addChild(arrowWrapper);
//			startComponent.parent.addChild(this);
//		}
		
		public function get initialPoint():Point{
			var start:Point = startImage.contentToGlobal(new Point(startImage.x,startImage.y));
				return new Point(start.x + startImage.width,start.y + startImage.height - 
				CoordinatesUtils.getCanvasLocalToGlobalCoordinates().y + HALF_CONTAINER_HEIGHT *2
				 + OFFSET_SELF_ARROW_HEIGHT);	
		}
		
		public function get height():Number{
			return CoordinatesUtils.SELF_ARROW_HEIGHT;
		}
		public function get width():Number{
			return CoordinatesUtils.SELF_ARROW_WIDTH << 1;
		}
		
		public function get arrowWrapper():ArrowWrapper{
			var relativeStartPoint:Point = new Point(0,height);
			var relativeEndPoint:Point = new Point(width,height);
			return new ArrowWrapper(relativeStartPoint,relativeEndPoint,true);
		}
		
		
		

	}
}